package com.haoting.mamba.match.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.haoting.common.utils.PageUtils;
import com.haoting.common.utils.Query;

import com.haoting.mamba.match.dao.MatchInformationDao;
import com.haoting.mamba.match.entity.MatchInformationEntity;
import com.haoting.mamba.match.service.MatchInformationService;


@Service("matchInformationService")
public class MatchInformationServiceImpl extends ServiceImpl<MatchInformationDao, MatchInformationEntity> implements MatchInformationService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<MatchInformationEntity> wrapper  = new QueryWrapper<>();
        if(!String.valueOf(params.get("query")).equals("")){
            wrapper.like("match_date",params.get("query"));
        }
        IPage<MatchInformationEntity> page = this.page(
                new Query<MatchInformationEntity>().getPage(params),
                wrapper.orderByDesc("match_date")

        );

        return new PageUtils(page);
    }

}